<!--
Copyright (c) 2021-2024 SigScalr, Inc.

This file is part of SigLens Observability Solution

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
-->

<!DOCTYPE html>
<html lang="en">

<script async src="https://www.googletagmanager.com/gtag/js?id=G-5SBJC04YFB"></script>
<script>
    window.dataLayer = window.dataLayer || [];
    function gtag() { dataLayer.push(arguments); }
    gtag('js', new Date());

    gtag('config', 'G-5SBJC04YFB');
</script>

<head>
    <title>Cluster Stats</title>

    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <link rel="apple-touch-icon" sizes="180x180" href="assets/apple-touch-icon.png">
    <link rel="icon" type="image/png" sizes="32x32" href="assets/favicon-32x32.png">
    <link rel="icon" type="image/png" sizes="16x16" href="assets/favicon-16x16.png">
    <link rel="manifest" href="assets/site.webmanifest">
    <link rel="mask-icon" href="assets/safari-pinned-tab.svg" color="#5bbad5">
    <meta name="msapplication-TileColor" content="#da532c">

    <link rel="stylesheet" href="./css/lib/all.min.css" />
    <link rel="stylesheet" href="./css/lib/bootstrap.min.css" />
    <link rel="stylesheet" href="./css/lib/jquery.dataTables.min.css" />
    <link rel="stylesheet" href="./css/lib/scroller.dataTables.min.css" />
    <link rel="stylesheet" href="./css/siglens.css?cb={{ AppVersion }}" />

    <script src="./js/lib/lodash.min.js"></script>
    <script src="./js/lib/jquery-3.6.0.min.js"></script>
    <script src="./js/lib/jquery-ui.min.js"></script>
    <script src="./js/lib/js.cookie.min.js"></script>
    <script src="./js/lib/moment.min.js"></script>
    <script src="./js/lib/date_fns.min.js"></script>
    <script src="./js/lib/popper.min.js"></script>
    <script src="./js/lib/bootstrap.bundle.min.js"></script>
    <script src="./js/lib/jquery.dataTables.min.js"></script>
    <script src="./js/lib/dataTables.scroller.min.js"></script>
    <script src="./js/lib/chart.umd.min.js"></script>

    <script>
        var defaultTheme = Cookies.get('theme') || 'light';
        $('html').attr('data-theme', defaultTheme);
    </script>
    {{.RunCheck1 | safeHTML}}
</head>

<body>
    <div id="cstats-app-container">
        <div id="app-side-nav">
        </div>
        <div id="empty-response"></div>
        <div id="app-content-area">
            <div class="cstats-data-container myOrg-container">
                <div class="org-nav-tab subsection-navbar align-items-end justify-content-between">
                    <div class="d-flex flex-column justify-content-between align-items-end">
                    </div>
                </div>
                <div class="myOrg-inner-container" >
                    <div class="align-items-end justify-content-between d-flex">
                        <p class="caption">Track progress and performance </p>
                    </div>
                    <p class="index-stats-header">Logs Stats</p>
                    <div class="query-index-container">
                        <div class="index-stats">
                            <table id="index-data-table" class="index-data-table"></table>
                        </div>
                    </div>
                    <div class="graph-container logs-container">
                        <div class="bar_chart_container">
                            <canvas id="TotalVolumeChart-logs"></canvas>
                            <div class="bar-graph-footer">Logs Storage</div>
                        </div>
                        <div class="storage-savings-container">
                            <div class="fw-bold storage-savings-title">
                                Storage Savings
                            </div>
                        </div>
                        <div class="popupContent" id="confirm-del-index-prompt">
                            <h3 class="header">Delete Index</h3>
                            <div class="del-org-prompt-text-container">
                                <div class="prompt-text">Are you sure you want to delete the "<strong><span></span></strong>" index?</div>
                                <div class="prompt-text prompt-text-bottom">To confirm the action, please type "<b>delete </b><strong><span></span></strong>".</div>
                            </div>
                            <input type="text" id="del-index-name-input" class="prompt-input">
                            <div class="btncontainer">
                                <button type="button" id="cancel-del-index-btn" class="cancel-btn btn btn-primary">Cancel</button>
                                <button type="button" id="del-index-btn" class="btn" disabled="true">Delete</button>
                            </div>
                        </div>
                        <div class="popupContent" id="index-summary-prompt">
                            <div class="d-flex justify-content-between align-items-center">
                                <h3 class="header">Index Summary: <span id="index-name"></span></h3>
                                <div class="close-btn"></div>
                            </div>
                            <div class="summary-content">
                                <p><strong>Incoming Volume:</strong> <span id="incoming-volume"></span></p>
                                <p><strong>Storage Used:</strong> <span id="storage-used"></span></p>
                                <p><strong>Event Count:</strong> <span id="event-count"></span></p>
                                <p><strong>Segment Count:</strong> <span id="segment-count"></span></p>
                                <p><strong>Column Count:</strong> <span id="column-count"></span></p>
                                <p><strong>Earliest Record:</strong> <span id="earliest-record"></span></p>
                                <p><strong>Latest Record:</strong> <span id="latest-record"></span></p>
                                <p><strong>Total Cmi Size:</strong> <span id="total-cmi-size"></span></p>
                                <p><strong>Total Csg Size:</strong> <span id="total-csg-size"></span></p>
                                <p><strong>Num of Index Files:</strong> <span id="num-index-files"></span></p>
                                <p><strong>Num of Blocks:</strong> <span id="num-blocks"></span></p>
                            </div>
                            <div class="mt-2 d-flex justify-content-end">
                                <button type="button" id="close-popup" class="saveqButton btn-primary btn">OK</button>
                            </div>
                        </div>
                        <div class="popupOverlay"></div>
                    </div>
                    <hr>
                    <p class="index-stats-header mt-5">Metrics Stats</p>
                    <div class="query-index-container">
                        <div class="index-stats">
                            <table id="metrics-data-table" class="index-data-table"></table>
                        </div>
                    </div>
                    <div class="graph-container metrics-container">
                        <div class="bar_chart_container">
                            <canvas id="TotalVolumeChart-metrics"></canvas>
                            <div class="bar-graph-footer">Metrics Storage</div>
                        </div>
                        <div class="storage-savings-container">
                            <div class="fw-bold storage-savings-title">
                                Storage Savings
                            </div>
                        </div>
                    </div>
                    <hr>
                    <p class="index-stats-header mt-5">Traces Stats</p>
                    <div class="query-index-container">
                        <div class="index-stats">
                            <table id="trace-data-table" class="index-data-table"></table>
                        </div>
                    </div>
                    <div class="graph-container traces-container">
                        <div class="bar_chart_container">
                            <canvas id="TotalVolumeChart-traces"></canvas>
                            <div class="bar-graph-footer">Traces Storage</div>
                        </div>
                        <div class="storage-savings-container">
                            <div class="fw-bold storage-savings-title">
                                Storage Savings
                            </div>
                        </div>
                    </div>
                    <hr>
                    <div id="cstats-app-footer">
                    </div>
                </div>
            </div>
        </div>

    </div>

    <script src="./js/navbar.js?cb={{ AppVersion }}"></script>
    <script src="./js/cluster-stats.js?cb={{ AppVersion }}"></script>
    <script src="./js/event-handlers.js?cb={{ AppVersion }}"></script>
    <script src="./js/common.js?cb={{ AppVersion }}"></script>
    <script src="./js/date-picker.js?cb={{ AppVersion }}"></script>
    <script src="./component/upper-navbar/upper-navbar.js?cb={{ AppVersion }}"></script>
    <script src="./js/footer.js?cb={{ AppVersion }}"></script>

    {{ .RunCheck2 | safeHTML }}
    {{ .RunCheck3 | safeHTML }}
</body>

</html>
